package com.example.myspringboot.kafkaUnits;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

/**
 * @author zheng
 */
@Component
public class KafkaTestListener {

    private final static Logger logger = LoggerFactory.getLogger(KafkaTestListener .class);

    @KafkaListener(topics = "testDemo")
    public void imChatUserGroupListener(ConsumerRecord<String, Object> consumerRecord) {
        logger.error("--=====================================================================================================================" + consumerRecord.topic());
        logger.error("--" + consumerRecord.offset());
        logger.error("--" + consumerRecord.value());
        logger.error("--" + consumerRecord.key());
    }

    @KafkaListener(topics = "zhengshanTest")
    public void imChatUserGroupListenerTwo(ConsumerRecord<String, Object> consumerRecord) {
        logger.info("---------->>>>>>>>>>>>>>" + consumerRecord.value());
    }
}
